import { EntityModel } from '@midwayjs/orm';
import { BaseEntity } from 'midwayjs-cool-core';
import { Column, PrimaryGeneratedColumn } from 'typeorm';

/**
 * 图片实体：
 *   - 名字、绝对路径
 *   - 多对多：图片可被多途径引用、且每个途径可引用多张图片
 */
@EntityModel('mall_picture')
export class MallPictureEntity extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '名字' })
  name: string;

  @Column({ comment: 'URL', unique: true })
  url: string;

  @Column()
  width: number;

  @Column()
  height: number;

  @Column()
  size: number;
}
